<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    34. Find First and Last Position of Element in Sorted Array
   </h1>
   <p>
    Given an array of integers
    <code>
     nums
    </code>
    sorted in ascending order, find the starting and ending position of a given
    <code>
     target
    </code>
    value.
   </p>
   <p>
    Your algorithm's runtime complexity must be in the order of
    <em>
     O
    </em>
    (log
    <em>
     n
    </em>
    ).
   </p>
   <p>
    If the target is not found in the array, return
    <code>
     [-1, -1]
    </code>
    .
   </p>
   <p>
    <strong>
     Example 1:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> nums = [<code>5,7,7,8,8,10]</code>, target = 8
<strong>Output:</strong> [3,4]</pre>
   <p>
    <strong>
     Example 2:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> nums = [<code>5,7,7,8,8,10]</code>, target = 6
<strong>Output:</strong> [-1,-1]</pre>
  </div>
  <div>
   <h1 class="question_title">
    34. 在排序数组中查找元素的第一个和最后一个位置
   </h1>
   <p>
    给定一个按照升序排列的整数数组
    <code>
     nums
    </code>
    ，和一个目标值
    <code>
     target
    </code>
    。找出给定目标值在数组中的开始位置和结束位置。
   </p>
   <p>
    你的算法时间复杂度必须是&nbsp;
    <em>
     O
    </em>
    (log
    <em>
     n
    </em>
    ) 级别。
   </p>
   <p>
    如果数组中不存在目标值，返回&nbsp;
    <code>
     [-1, -1]
    </code>
    。
   </p>
   <p>
    <strong>
     示例 1:
    </strong>
   </p>
   <pre><strong>输入:</strong> nums = [<code>5,7,7,8,8,10]</code>, target = 8
<strong>输出:</strong> [3,4]</pre>
   <p>
    <strong>
     示例&nbsp;2:
    </strong>
   </p>
   <pre><strong>输入:</strong> nums = [<code>5,7,7,8,8,10]</code>, target = 6
<strong>输出:</strong> [-1,-1]</pre>
  </div>
 </body>
</html>